﻿using System.ComponentModel;
using STeaL.ComponentModel;

namespace RPNcalc {

  public class WordEntry : INotifyPropertyChanged {
    public WordEntry(string k, string v) { Key = k; Value = v; }

    public string Key   { get { return key_;   } set { key_   = value; PropertyChanged.Notify(this,"Key");   } }
    public string Value { get { return value_; } set { value_ = value; PropertyChanged.Notify(this,"Value"); } }

    public event PropertyChangedEventHandler PropertyChanged;

    public override string ToString() { return Key + " " + Value; }
    public static WordEntry FromString(string str) {
      if ( str == null ) return null;
      string value = str;
      string key = Utils.Tokenize(ref value);
      return new WordEntry(key,value);
    }

    private string value_;
    private string key_;
  }

}
